package action.custom;

import java.util.List;

import core.action.BaseAction;
import exception.Exceptions;
import model.company.*;
import model.credit.Lcbank;
import service.custom.CustomLcBankInforService;
import service.custom.CustomServiceDo;
import util.Sessions;

public class CustomActionShow extends BaseAction{
	private CustomServiceDo customServiceDo;
	private Integer id;
	public String FLAG="EDIT";//标识为编辑
	public String flage;      //是否有保存功能  flage = modify 时显示保存按钮
	
	

	private Companypledger companypledger;//抵质押清单	
	private Companyforeigninvestment cforeigninvestor;
	private Companygivingcredit  cgivingcredit;
	private Companyguarantor cguarantor;
	private Companyinvestor cinvestor;
	private Companylisting clisting;
	private Companyprosecuted cprosecuted;
	private Companytopmanager ctopmanager;
	private Companybasic cbasic;
	private Companycontact ccontact;
	private Companyexternalguarantee cexternalguarantee;
	private Companymanage cmanage;
	private Companybankcredit cbankcredit;
	private Companyassetsdebt cassetsdebt;
	private Companycashflow ccashflow;
	private Companyprofit cprofit;
	private Companyotherloan cotherloan;
	
	public String getFlage() {
		return flage;
	}

	public void setFlage(String flage) {
		Sessions.set("eflage", flage);
		this.flage = flage;
	}
	
	public Companyotherloan getCotherloan() {
		return cotherloan;
	}

	public void setCotherloan(Companyotherloan cotherloan) {
		this.cotherloan = cotherloan;
	}

	private CustomLcBankInforService customLcBankInforService;
	private List<Lcbank> lcbankList;
	
	
	public Companyprofit getCprofit() {
		return cprofit;
	}

	public void setCprofit(Companyprofit cprofit) {
		this.cprofit = cprofit;
	}

	public Companycashflow getCcashflow() {
		return ccashflow;
	}

	public void setCcashflow(Companycashflow ccashflow) {
		this.ccashflow = ccashflow;
	}

	public Companyassetsdebt getCassetsdebt() {
		return cassetsdebt;
	}

	public void setCassetsdebt(Companyassetsdebt cassetsdebt) {
		this.cassetsdebt = cassetsdebt;
	}

	public Companybankcredit getCbankcredit() {
		return cbankcredit;
	}

	public void setCbankcredit(Companybankcredit cbankcredit) {
		this.cbankcredit = cbankcredit;
	}

	public String getFLAG() {
		return FLAG;
	}

	public void setFLAG(String fLAG) {
		FLAG = fLAG;
	}


	
	public Companymanage getCmanage() {
		return cmanage;
	}

	public void setCmanage(Companymanage cmanage) {
		this.cmanage = cmanage;
	}

	public String execute() {
		return "success";
	}
	
	public String externalguaranteeshow(){
		cexternalguarantee=customServiceDo.externalguaranteeShow(id);
		super.successResultValue="NewCompanyExternalguarantee";
		return "success";
	}
	
	public String bankcreditshow(){
		cbankcredit=customServiceDo.bankcreditShow(id);
		super.successResultValue="NewCompanyBankcredit";
		return "success";
	}
	
	public String manageshow() throws Exceptions{
		cmanage=customServiceDo.manageShow(id);
		this.lcbankList = this.customLcBankInforService.findList((Integer)Sessions.get("companyid"), id, 2);
		super.successResultValue="NewCompanyManage";
		return "success";
	}
	
	public String companymodify(){
			if(id != null){
			Sessions.set("companyid",id);
			cbasic=customServiceDo.companyShow(id);
			}else if(Sessions.get("companyid") != null){
				cbasic=customServiceDo.companyShow((Integer)Sessions.get("companyid"));
			}
			Sessions.set("eflage", "modify");
			super.successResultValue="NewCompanyBasic";
			return "success";
	}
	
	
	public String companyread(){
		if(id != null){
		Sessions.set("companyid",id);
		cbasic=customServiceDo.companyShow(id);
		}else if(Sessions.get("companyid") != null){
			cbasic=customServiceDo.companyShow((Integer)Sessions.get("companyid"));
		}
		System.out.println("in31" + Sessions.get("eflage"));
		super.successResultValue="NewCompanyBasic";
		return "success";
}
	
	
	public String companyshow(){
		if(id != null){
		Sessions.set("companyid",id);
		cbasic=customServiceDo.companyShow(id);
		}else if(Sessions.get("companyid") != null){
			cbasic=customServiceDo.companyShow((Integer)Sessions.get("companyid"));
		}
		Sessions.set("eflage", "show");
		super.successResultValue="NewCompanyBasic";
		return "success";
	}

	public String pledgershowpersonal(){
		companypledger=customServiceDo.pledgerShow(id);
		super.successResultValue="NewPersonalPledger";
		return "success";
	}
	
	public String pledgershow(){
		companypledger=customServiceDo.pledgerShow(id);
		super.successResultValue="NewCompanyPledger";
		return "success";
	}
	
	public String contactshow(){
		ccontact=customServiceDo.contactShow(id);
		super.successResultValue="NewCompanyContact";
		return "success";
	}
	
	public String foreigninvestorshow(){
		cforeigninvestor=customServiceDo.foreigninvestorShow(id);
		super.successResultValue="NewCompanyForeigninvestor";
		return "success";
	}
	
	public String givingcreditshow(){
		cgivingcredit=customServiceDo.givingcreditShow(id);
		super.successResultValue="NewCompanyGivingcredit";
		return "success";
	}
	
	public String guarantorshow(){
		cguarantor=customServiceDo.guarantorShow(id);
		super.successResultValue="NewCompanyGuarantor";
		return "success";
	}
	
	public String investorshow(){
		cinvestor=customServiceDo.investorShow(id);
		super.successResultValue="NewCompanyInvestor";
		return "success";
	}
	
	
	public String cashflowshow(){
		ccashflow=customServiceDo.cashflowShow(id);
		super.successResultValue="NewCompanyCashflow";
		return "success";
	}
	
	public String profitshow(){
		cprofit=customServiceDo.profitShow(id);
		super.successResultValue="NewCompanyProfit";
		return "success";
	}
	
	public String assetsdebtshow(){
		cassetsdebt=customServiceDo.assetsdebtShow(id);
		super.successResultValue="NewCompanyAssetsdebt";
		return "success";
	}
	
	public String listingshow(){
		clisting=customServiceDo.listingShow(id);
		super.successResultValue="NewCompanyListing";
		return "success";
	}
	
	public String prosecutedshow(){
		cprosecuted=customServiceDo.prosecutedShow(id);
		super.successResultValue="NewCompanyProsecuted";
		return "success";
	}
	
	public String topmanagershow(){
		ctopmanager=customServiceDo.topmanagerShow(id);
		super.successResultValue="NewCompanyTopmanager";
		return "success";
	}
	
	
	public String otherloanshow(){
		cotherloan = customServiceDo.otherloanShow(id);
		super.successResultValue = "NewCompanyOtherloan";
		return "success";
	}

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	public CustomServiceDo getCustomServiceDo() {
		return customServiceDo;
	}


	public void setCustomServiceDo(CustomServiceDo customServiceDo) {
		this.customServiceDo = customServiceDo;
	}

	public Companypledger getCompanypledger() {
		return companypledger;
	}

	public void setCompanypledger(Companypledger companypledger) {
		this.companypledger = companypledger;
	}

	public Companyforeigninvestment getCforeigninvestor() {
		return cforeigninvestor;
	}

	public void setCforeigninvestor(Companyforeigninvestment cforeigninvestor) {
		this.cforeigninvestor = cforeigninvestor;
	}

	public Companygivingcredit getCgivingcredit() {
		return cgivingcredit;
	}

	public void setCgivingcredit(Companygivingcredit cgivingcredit) {
		this.cgivingcredit = cgivingcredit;
	}

	public Companyguarantor getCguarantor() {
		return cguarantor;
	}

	public void setCguarantor(Companyguarantor cguarantor) {
		this.cguarantor = cguarantor;
	}

	public Companyprosecuted getCprosecuted() {
		return cprosecuted;
	}

	public void setCprosecuted(Companyprosecuted cprosecuted) {
		this.cprosecuted = cprosecuted;
	}

	public Companyinvestor getCinvestor() {
		return cinvestor;
	}

	public void setCinvestor(Companyinvestor cinvestor) {
		this.cinvestor = cinvestor;
	}

	public Companylisting getClisting() {
		return clisting;
	}

	public void setClisting(Companylisting clisting) {
		this.clisting = clisting;
	}

	public Companytopmanager getCtopmanager() {
		return ctopmanager;
	}

	public void setCtopmanager(Companytopmanager ctopmanager) {
		this.ctopmanager = ctopmanager;
	}

	public Companybasic getCbasic() {
		return cbasic;
	}

	public void setCbasic(Companybasic cbasic) {
		this.cbasic = cbasic;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Companycontact getCcontact() {
		return ccontact;
	}

	public void setCcontact(Companycontact ccontact) {
		this.ccontact = ccontact;
	}

	public Companyexternalguarantee getCexternalguarantee() {
		return cexternalguarantee;
	}

	public void setCexternalguarantee(Companyexternalguarantee cexternalguarantee) {
		this.cexternalguarantee = cexternalguarantee;
	}

	public CustomLcBankInforService getCustomLcBankInforService() {
		return customLcBankInforService;
	}

	public void setCustomLcBankInforService(
			CustomLcBankInforService customLcBankInforService) {
		this.customLcBankInforService = customLcBankInforService;
	}

	public List<Lcbank> getLcbankList() {
		return lcbankList;
	}

	public void setLcbankList(List<Lcbank> lcbankList) {
		this.lcbankList = lcbankList;
	}
}
